﻿function AddReq()
{
    invisiblise();
    var requestSpace = document.getElementById("newStorage");
    requestSpace.style.display = "inline";
}

function invisiblise()
{
    //this is surprisingly simple. Get the element from the document that has the id field "actionbuttons", and set it's style's display to none! That's it! Magic!
    document.getElementById("actionbuttons").style.display = "none";
}

function revisiblise()
{
    document.getElementById("actionbuttons").style.display = "inline";
}

function adminAddUser()
{
    invisiblise();
    document.getElementById("AddUser").style.display = "inline";
}

function adminAddProject()
{
    invisiblise();
    document.getElementById("AddProject").style.display = "inline";
}

function validateSizeForm()
{
    var x = document.forms["newRequestData"]["storageSize"].value;
    //isFinite(null) true so null check also
    if ((x == null || false == isNumber(x)))
    {
        alert("Size must be a number");
        return false;
    }
}

function isNumber(input)
{
    return !isNaN(input);
}

function adminRemoveUser()
{
    invisiblise();
    document.getElementById("RemoveUser").style.display = "inline";

}
function adminRemoveProject()
{
    invisiblise();
    document.getElementById("RemoveProject").style.display = "inline";
}

function adminChangePrimaryInv() {
    invisiblise();
    document.getElementById("ChangePrimaryInv").style.display = "inline";
}

function adminAddSchool() {
    invisiblise();
    document.getElementById("AddSchool").style.display = "inline";
}
function passwordVerify() {
    var passone = document.forms["superform"]["Password"].value;
    var passtwo = document.forms["superform"]["PassTwo"].value;
    ;

    document.getElementById("submitID").style.display = "hidden";
    if(passone == passtwo)
    {
        document.getElementById("submitID").style.display = "block"
    } else {
        document.getElementById("submitID").style.display = "hidden";
        alert("They do not match!")
    }
}